-
-
Notifications
You must be signed in to change notification settings - Fork 3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
gateway: expose commands for js-libp2p delegated routing #4595
Conversation
Oh and this is already running on ipfs.io, so go take a shot at it @diasdavid |
Would putting these behind a config option be problematic? I worry about increasing the default gateway API a bit. |
Not at all, you have a point. I'll update this in the next few days. |
@magik6k mind taking over? |
I don't see any reasonably simple way to put this behind a config option (rootROOldSubcommands is set up in init), one 'hack' I have in mind is to create a utility command which would perform that check and proxy to the proper command, does that sound reasonable? |
Can the command itself not check and return a permission denied error? Not the best solution but it works. |
It would have to check if it was called from the gateway port in that case which I'm not sure is even possible. |
We could maybe eliminate the root/rootRO duality and have :8080 call the same root |
and a hardcoded list of commands that should not ever be exposed to the public. |
514af5e
to
0dc0a04
Compare
0dc0a04
to
287cbed
Compare
Exposes API methods for delegated routing on the gateway. License: MIT Signed-off-by: Lars Gierth <larsg@systemli.org>
ipfs: update to ipfs/kubo#4595
287cbed
to
6c76de3
Compare
I'm picking this back up this week -- let me know if there's reservations about the approach mentioned back in March:
|
License: MIT Signed-off-by: Lars Gierth <larsg@systemli.org>
6c76de3
to
23a68cd
Compare
@lgierth I think we may need to add some limiters on findProviders. I am testing this locally with an example of the current delegated routing implementation in js-libp2p. Other than limiting the number of providers there isn't currently any other limiter to the call. If I run For an http request to the delegated node, this can mean multiple http requests open for minutes at a time. For content I just added to my local go-ipfs instance, I've seen it exceed 30minutes for an open connection in browser. |
@jacobheun In go-ipfs there's a |
@jacobheun Just to confirm, do you need limiting on |
@lgierth my primary concern is too many open connections to the server. The current code for In the event that Even though I can lower I'm wondering if a default timeout is needed for these requests? |
Yeah sounds like some combination of |
Eeeh what I meant to say here: do you need the limiting on |
@lgierth I think |
Okay, cool -- |
Perfect, I can work on adding support and sane defaults for those in the routing modules. |
I've got the js-libp2p delegated routing work all ready to go and in review. I've got the timeouts configurable and currently defaulting to a max of 30 seconds. It's been verified against the example I demo'd a few weeks back, which is also in the PR for js-libp2p libp2p/js-libp2p#242 |
Update on the go side is that configurable Gateway API commands (aka "readonly API" commands) are ready, but I'm dealing with some nasty dependency issues - hopefully done by tomorrow. |
Closing this in favor of #5565 |
This enables js-libp2p/js-ipfs to delegate peer routing and content routing to a go-ipfs gateway (usually ipfs.io). It covers:
dht/findpeer
)dht/findprovs
)swarm/connect
with a/p2p-circuit
address), and then to fetch the data from us (refs?r=true
). This isn't technically content routing, but it makes the data available to the network which is all we need.Peer routing writes will be a new command that'll be covered in a future PR.
(@diasdavid catch!)